Ext.define('${app.appName}.view.${app.className}Form',{
	extend:'Ext.form.Panel',
	alias: 'widget.${app.lowerName}form',
    border:false,
    url:basePath+'/action/${app.lowerName}/editor.action',
    initComponent: function(){
        this.addEvents('create');
        Ext.apply(this,{
            items:[<#list app.items as items>
				<#include "form_container.ftl"></#list>]
        });
        this.callParent(arguments);
    },
    setActiveRecord: function(record){
        this.activeRecord = record;
        if (record||this.activeRecord) {
            this.getForm().loadRecord(record);
        } else {
            this.getForm().reset();
        }
    },
    onReset:function(){
        this.setActiveRecord(this.activeRecord);
    },
    onClose:function(){
        this.fireEvent('close', this);
        this.getForm().reset();
    },
    onSave: function(){
        var form = this.getForm();
        if (form.isValid()) {
            this.getForm().submit({
                url:this.url,
                //params:_params,
                type:'ajax',
                success:this.onSave,
                waitTitle:"data send",
                waitMsg:"Data transfer, please wait...",
                scope:this
            });
            this.fireEvent('create', this, form.getValues());
            form.reset();
        }

    }
});